import React, { useImperativeHandle, forwardRef } from 'react'

export default forwardRef((props) => {
    console.log("props", props)
    const { parentRef } = props;
    useImperativeHandle(parentRef, () => {
        return {
            childFn
        }
    })
    console.log(parentRef)
    const childFn = () => {
        console.log('子组件方法')
    }
    return <div>
        <div ref={parentRef} />
    </div>
})